{-# LANGUAGE OverloadedStrings #-}
module Pages.AddProblem(problemForm) where

import Control.Applicative
import State.Database

import Text.Blaze.Html5.Formlets
import Text.Blaze.Html5 (p)

import Prelude hiding (div, span)

import Pages.Formlets(inputProgram, labelled)

-- | A form for the input of ProblemInfo
problemForm :: (Applicative m, Monad m) => Html5Form m ProblemInfo
problemForm =
    ProblemInfo
    <$> labelled "Problem name:" (input Nothing)
    <*> labelled "Problem statement:" (plug p $ textarea (Just 20) (Just 40) Nothing)
    <*> labelled "Test validator:" (inputProgram Nothing)
    <*> labelled "Reference solution:" (inputProgram Nothing)
